package system

import (
	"fmt"

	"gitee.com/micro-plat/sso/apiserver/api/modules/const/field"
	"github.com/micro-plat/hydra"
)

func GetSecret(ident string) (string, error) {
	db := hydra.C.DB().GetRegularDB()
	data, err := db.Query(getSecret, map[string]interface{}{
		"ident": ident,
	})
	if err != nil {
		return "", err
	}
	if data.IsEmpty() {
		return "", fmt.Errorf("系统不存在%s", ident)
	}
	return data.Get(0).GetString(field.Secret), nil
}
